# 1.导包
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

# 2.创建浏览器驱动对象
# Firefox浏览器:
# driver = webdriver.Firefox()
# Chrome浏览器:
path = r"D:\Programs\Python\Python313\chromedriver.exe"
ser = Service(executable_path = path)
driver = webdriver.Chrome(service = ser)
# 使用Edge浏览器,不需要安装驱动
# driver = webdriver.Edge ()
# 3.打开Web页面
driver.get("http://www.baidu.com/")
# 4.暂停
time.sleep(5)
# 5.关闭浏览器驱动对象
driver.quit()